home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / ver.exe / SA_SETUP.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1994-05-01  |  13.9 KB  |  472 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Setup Apprentice"
  5.    ClientHeight    =   5490
  6.    ClientLeft      =   1035
  7.    ClientTop       =   2070
  8.    ClientWidth     =   6390
  9.    Height          =   6180
  10.    Icon            =   SA_SETUP.FRX:0000
  11.    Left            =   975
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   5490
  16.    ScaleWidth      =   6390
  17.    Top             =   1440
  18.    Width           =   6510
  19.    Begin CommonDialog CMDialog1 
  20.       Left            =   5640
  21.       Top             =   5040
  22.    End
  23.    Begin TextBox AppName 
  24.       Height          =   285
  25.       Left            =   2280
  26.       TabIndex        =   3
  27.       Top             =   480
  28.       Width           =   3855
  29.    End
  30.    Begin PictureBox Drop 
  31.       BorderStyle     =   0  'None
  32.       Height          =   495
  33.       Left            =   4080
  34.       Picture         =   SA_SETUP.FRX:0302
  35.       ScaleHeight     =   495
  36.       ScaleWidth      =   495
  37.       TabIndex        =   8
  38.       Top             =   5040
  39.       Visible         =   0   'False
  40.       Width           =   495
  41.    End
  42.    Begin PictureBox NoDrop 
  43.       BorderStyle     =   0  'None
  44.       Height          =   495
  45.       Left            =   3480
  46.       Picture         =   SA_SETUP.FRX:0604
  47.       ScaleHeight     =   495
  48.       ScaleWidth      =   495
  49.       TabIndex        =   7
  50.       Top             =   5040
  51.       Visible         =   0   'False
  52.       Width           =   495
  53.    End
  54.    Begin Timer Timer1 
  55.       Interval        =   100
  56.       Left            =   5160
  57.       Top             =   5040
  58.    End
  59.    Begin DirListBox Dir1 
  60.       Height          =   1380
  61.       Left            =   240
  62.       TabIndex        =   1
  63.       Top             =   1200
  64.       Width           =   1815
  65.    End
  66.    Begin DriveListBox Drive1 
  67.       Height          =   315
  68.       Left            =   240
  69.       TabIndex        =   0
  70.       Top             =   480
  71.       Width           =   1815
  72.    End
  73.    Begin FileListBox File1 
  74.       DragIcon        =   SA_SETUP.FRX:0906
  75.       Height          =   2175
  76.       Left            =   240
  77.       MultiSelect     =   2  'Extended
  78.       TabIndex        =   2
  79.       Top             =   3000
  80.       Width           =   1815
  81.    End
  82.    Begin ListBox IList 
  83.       DragIcon        =   SA_SETUP.FRX:0C08
  84.       Height          =   1005
  85.       Index           =   2
  86.       Left            =   2280
  87.       MultiSelect     =   2  'Extended
  88.       Sorted          =   -1  'True
  89.       TabIndex        =   6
  90.       Top             =   4080
  91.       Width           =   3855
  92.    End
  93.    Begin ListBox IList 
  94.       DragIcon        =   SA_SETUP.FRX:0F0A
  95.       Height          =   1005
  96.       Index           =   1
  97.       Left            =   2280
  98.       MultiSelect     =   2  'Extended
  99.       Sorted          =   -1  'True
  100.       TabIndex        =   5
  101.       Top             =   2760
  102.       Width           =   3855
  103.    End
  104.    Begin ListBox IList 
  105.       DragIcon        =   SA_SETUP.FRX:120C
  106.       Height          =   1395
  107.       Index           =   0
  108.       Left            =   2280
  109.       MultiSelect     =   2  'Extended
  110.       Sorted          =   -1  'True
  111.       TabIndex        =   4
  112.       Top             =   1080
  113.       Width           =   3855
  114.    End
  115.    Begin Label Label7 
  116.       Caption         =   "Application Name:"
  117.       Height          =   255
  118.       Left            =   2280
  119.       TabIndex        =   15
  120.       Top             =   240
  121.       Width           =   2295
  122.    End
  123.    Begin Label Label6 
  124.       Caption         =   "Files:"
  125.       Height          =   255
  126.       Left            =   240
  127.       TabIndex        =   14
  128.       Top             =   2760
  129.       Width           =   1215
  130.    End
  131.    Begin Label Label5 
  132.       Caption         =   "Directory:"
  133.       Height          =   255
  134.       Left            =   240
  135.       TabIndex        =   13
  136.       Top             =   960
  137.       Width           =   1215
  138.    End
  139.    Begin Label Label4 
  140.       Caption         =   "Drive:"
  141.       Height          =   255
  142.       Left            =   240
  143.       TabIndex        =   12
  144.       Top             =   240
  145.       Width           =   1215
  146.    End
  147.    Begin Label Label3 
  148.       Caption         =   "System Directory:"
  149.       Height          =   255
  150.       Left            =   2280
  151.       TabIndex        =   11
  152.       Top             =   3840
  153.       Width           =   2295
  154.    End
  155.    Begin Label Label2 
  156.       Caption         =   "Windows Directory:"
  157.       Height          =   255
  158.       Left            =   2280
  159.       TabIndex        =   10
  160.       Top             =   2520
  161.       Width           =   2295
  162.    End
  163.    Begin Label Label1 
  164.       Caption         =   "Application Directory:"
  165.       Height          =   255
  166.       Left            =   2280
  167.       TabIndex        =   9
  168.       Top             =   840
  169.       Width           =   2295
  170.    End
  171.    Begin Menu MenuFile 
  172.       Caption         =   "&File"
  173.       Begin Menu MenuFileOpen 
  174.          Caption         =   "&Open"
  175.       End
  176.       Begin Menu MenuFileClose 
  177.          Caption         =   "&Close"
  178.       End
  179.       Begin Menu MenuFileSave 
  180.          Caption         =   "&Save"
  181.       End
  182.       Begin Menu MenuFileSaveAs 
  183.          Caption         =   "Save &As"
  184.       End
  185.       Begin Menu sep1 
  186.          Caption         =   "-"
  187.       End
  188.       Begin Menu MenuFileExit 
  189.          Caption         =   "E&xit"
  190.       End
  191.    End
  192.    Begin Menu MenuCreateDisk 
  193.       Caption         =   "Create Disk!"
  194.       Enabled         =   0   'False
  195.    End
  196.    Begin Menu MenuHelp 
  197.       Caption         =   "&Help"
  198.       Begin Menu MenuHelpAbout 
  199.          Caption         =   "&About Setup Apprentice ..."
  200.       End
  201.    End
  202. Option Explicit
  203. Dim SetupFilename As String
  204. Dim fChanged As Integer
  205. Dim StartDrag As Integer
  206. Dim DragStart As Integer
  207. Dim DragCount As Integer
  208. Sub AppName_Change ()
  209.     SetFormCaption
  210.     MenuCreateDisk.Enabled = Len(AppName.Text)
  211. End Sub
  212. Function CheckSave () As Integer
  213.     If fChanged Then
  214.     End If
  215.     CheckSave = True
  216. End Function
  217. Sub Dir1_Change ()
  218.     File1.Path = Dir1.Path
  219. End Sub
  220. Sub Dir1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  221.     DragOver Source, State
  222. End Sub
  223. Sub Drive1_Change ()
  224.     Dir1.Path = Drive1.Drive
  225. End Sub
  226. Sub Drive1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  227.     DragOver Source, State
  228. End Sub
  229. Sub File1_MouseDown (Button As Integer, Shift As Integer, X As Single, Y As Single)
  230.     If (Button = 1) And File1.ListIndex <> -1 Then
  231.         StartDrag = True
  232.         DragStart = -1
  233.         Timer1.Enabled = True
  234.     End If
  235. End Sub
  236. Sub File1_MouseUp (Button As Integer, Shift As Integer, X As Single, Y As Single)
  237.     If (Button = 1) Then StartDrag = False: File1.Drag 0
  238. End Sub
  239. Sub Form_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  240.     DragOver Source, State
  241. End Sub
  242. Sub Form_Load ()
  243.     SetupClear
  244.     SetFormCaption
  245. End Sub
  246. Sub Form_Unload (Cancel As Integer)
  247.     If CheckSave() Then End
  248. End Sub
  249. Sub IList_DragDrop (Index As Integer, Source As Control, X As Single, Y As Single)
  250.     Dim fAdd As Integer
  251.     Dim I As Integer
  252.     Dim J As Integer
  253.     Dim N As Integer
  254.     Dim S As String
  255.     Dim DirPath As String
  256.     fChanged = True
  257.     If (DragStart <> Index) Then
  258.         If (DragStart = -1) Then
  259.             N = File1.ListCount
  260.             If Right$(Dir1.Path, 1) = "\" Then
  261.                 DirPath = Dir1.Path
  262.             Else
  263.                 DirPath = Dir1.Path & "\"
  264.             End If
  265.         Else
  266.             N = IList(DragStart).ListCount
  267.         End If
  268.         For I = N - 1 To 0 Step -1
  269.             S = ""
  270.             If (DragStart = -1) Then
  271.                 If File1.Selected(I) Then S = DirPath & File1.List(I)
  272.             ElseIf IList(DragStart).Selected(I) Then
  273.                 S = IList(DragStart).List(I)
  274.                 IList(DragStart).RemoveItem I
  275.             End If
  276.             If Len(S) Then
  277.                 fAdd = True
  278.                 For J = 0 To IList(Index).ListCount - 1
  279.                     If S = IList(Index).List(J) Then
  280.                         fAdd = False
  281.                         Exit For
  282.                     End If
  283.                 Next J
  284.                 If fAdd Then IList(Index).AddItem S
  285.             End If
  286.         Next I
  287.     End If
  288. End Sub
  289. Sub IList_MouseDown (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  290.     Dim I As Integer
  291.     If (Button = 1) And IList(Index).ListIndex <> -1 Then
  292.         StartDrag = True
  293.         DragStart = Index
  294.         Timer1.Enabled = True
  295.     End If
  296.     If (Button = 2) Then
  297.         MsgBox Format$(Y)
  298.     End If
  299. End Sub
  300. Sub IList_MouseUp (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  301.     If Button = 1 Then StartDrag = False: IList(Index).Drag 0
  302. End Sub
  303. Sub Label1_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  304.     DragOver Source, State
  305. End Sub
  306. Sub Label2_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  307.     DragOver Source, State
  308. End Sub
  309. Sub Label3_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  310.     DragOver Source, State
  311. End Sub
  312. Sub Label4_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  313.     DragOver Source, State
  314. End Sub
  315. Sub Label5_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  316.     DragOver Source, State
  317. End Sub
  318. Sub Label6_DragOver (Source As Control, X As Single, Y As Single, State As Integer)
  319.     DragOver Source, State
  320. End Sub
  321. Sub MenuCreateDisk_Click ()
  322.     Form1.Hide
  323.     Form3.Show 1
  324.     Form1.Show
  325. End Sub
  326. Sub MenuFileClose_Click ()
  327.     If CheckSave() Then SetupClear
  328. End Sub
  329. Sub MenuFileExit_Click ()
  330.     If CheckSave() Then End
  331. End Sub
  332. Sub MenuFileOpen_Click ()
  333.     On Error GoTo NoOpen
  334.     CMDialog1.Filename = "*.SA"
  335.     CMDialog1.Flags = &H9804
  336.     CMDialog1.Filter = "Setup Assitant (*.SA)|*.SA|All Files (*.*)|*.*"
  337.     CMDialog1.CancelError = True
  338.     CMDialog1.Action = 1
  339.     OpenSetup CMDialog1.Filename
  340.     SetupFilename = CMDialog1.Filename
  341.     Call SetFormCaption
  342.     GoTo OpenDone
  343. NoOpen:
  344.     Resume OpenDone
  345. OpenDone:
  346.     On Error GoTo 0
  347. End Sub
  348. Sub MenuFileSave_Click ()
  349.     If AppName.Text = "" Then
  350.         Beep
  351.         MsgBox "You need to fill in the Application Name.", 48, "Save File"
  352.     ElseIf SetupFilename = "" Then
  353.         Call MenuFileSaveAs_Click
  354.     Else
  355.         SaveSetup SetupFilename
  356.     End If
  357. End Sub
  358. Sub MenuFileSaveAs_Click ()
  359.     Dim I As Integer
  360.     Dim S As String
  361.     Dim C As String
  362.     If AppName.Text = "" Then
  363.         Beep
  364.         MsgBox "You need to fill in the Application Name.", 48, "Save File"
  365.         Exit Sub
  366.     End If
  367.     On Error GoTo NoSave
  368.     If SetupFilename <> "" Then
  369.         CMDialog1.Filename = "*.SA"
  370.     Else
  371.         S = ""
  372.         For I = 1 To Len(AppName.Text)
  373.             C = Mid$(UCase$(AppName.Text), I, 1)
  374.             If ((C >= "A") And (C <= "Z")) Then S = S & Mid$(AppName.Text, I, 1)
  375.         Next I
  376.         CMDialog1.Filename = Left$(S, 8) & ".SA"
  377.     End If
  378.     CMDialog1.Flags = &H9804
  379.     CMDialog1.Filter = "Setup Assitant (*.SA)|*.SA|All Files (*.*)|*.*"
  380.     CMDialog1.CancelError = True
  381.     CMDialog1.Action = 2
  382.     SetupFilename = CMDialog1.Filename
  383.     Call SetFormCaption
  384.     SaveSetup CMDialog1.Filename
  385.     GoTo SaveDone
  386. NoSave:
  387.     Resume SaveDone
  388. SaveDone:
  389.     On Error GoTo 0
  390. End Sub
  391. Sub MenuHelpAbout_Click ()
  392.     Form2.Show 1
  393. End Sub
  394. Sub OpenSetup (ByVal Filename As String)
  395.     Dim S As String
  396.     SetupClear
  397.     SetupFilename = Filename
  398.     MenuCreateDisk.Enabled = False
  399.     Open Filename For Input Access Read As #1
  400.     While Not EOF(1)
  401.         Input #1, S
  402.         If Left$(S, 8) = "AppName" Then
  403.             AppName.Text = Mid$(S, 9)
  404.             MenuCreateDisk.Enabled = Len(AppName.Text)
  405.         ElseIf Left$(S, 7) = "WinDir " Then
  406.             IList(1).AddItem Mid$(S, 8)
  407.         ElseIf Left$(S, 7) = "SysDir " Then
  408.             IList(2).AddItem Mid$(S, 8)
  409.         ElseIf Left$(S, 7) = "AppDir " Then
  410.             IList(0).AddItem Mid$(S, 8)
  411.         ElseIf Left$(S, 6) = "Drive " Then
  412.             Drive1.Drive = Mid$(S, 7)
  413.         ElseIf Left$(S, 4) = "Dir " Then
  414.             Dir1.Path = Mid$(S, 5)
  415.             File1.Path = Mid$(S, 5)
  416.         End If
  417.     Wend
  418.     Close #1
  419. End Sub
  420. Sub SetFormCaption ()
  421.     Dim S As String
  422.     S = "Setup Apprentice - "
  423.     If Len(AppName.Text) Then
  424.         S = S & AppName.Text
  425.     Else
  426.         S = S & "New Application"
  427.     End If
  428.     If Len(SetupFilename) Then
  429.         S = S & " [" & SetupFilename & "]"
  430.     Else
  431.         S = S & " [UNKNOWN.SA]"
  432.     End If
  433.     Form1.Caption = S
  434. End Sub
  435. Sub SetupClear ()
  436.     fChanged = False
  437.     AppName.Text = ""
  438.     SetupFilename = ""
  439.     IList(0).Clear
  440.     IList(1).Clear
  441.     IList(2).Clear
  442. End Sub
  443. Sub Timer1_Timer ()
  444.     Dim I As Integer
  445.     Dim N As Integer
  446.     If StartDrag Then
  447.         Timer1.Enabled = False
  448.         N = 0
  449.         Select Case DragStart
  450.             Case -1:
  451.                 For I = 0 To File1.ListCount - 1
  452.                     If File1.Selected(I) Then N = N + 1
  453.                 Next I
  454.             Case Else:
  455.                 For I = 0 To IList(DragStart).ListCount - 1
  456.                     If IList(DragStart).Selected(I) Then N = N + 1
  457.                 Next I
  458.         End Select
  459.         If N Then
  460.             Select Case DragStart
  461.                 Case -1:
  462.                     File1.DragIcon = Drop.Picture
  463.                     File1.Drag 1
  464.                 Case Else:
  465.                     IList(DragStart).DragIcon = Drop.Picture
  466.                     IList(DragStart).Drag 1
  467.             End Select
  468.         End If
  469.         StartDrag = False
  470.     End If
  471. End Sub
  472.